package com.gams.config;

import lombok.extern.log4j.Log4j;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import zkteco.id100com.jni.id100sdk;

/**
 * 系统初始化处理
 */
@Component
@Log4j
public class InitStart implements InitializingBean
{

    @Autowired
    private ClientConfig clientConfig;


    @Override
    public void afterPropertiesSet()
    {
        ConfigConstant.deviceId = clientConfig.getDeviceId();
        ConfigConstant.ip = clientConfig.getIp();
        ConfigConstant.project_name = clientConfig.getProject_name();
        ConfigConstant.serial_port = clientConfig.getSerial_port();
        ConfigConstant.port = Integer.parseInt(clientConfig.getPort());

        //----读身份证开启
        if (id100sdk.InitCommExt() <= 0)
        {
            log.info("读身份证开启失败");
            return;
        }
        log.info("读身份证开启成功");
    }
}
